import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
        path: '/user', // 我的
        component: () =>
            import ('../views/user/index.vue'),
        children: [{
                path: 'member', // 会员中心
                name: 'member',
                component: () =>
                    import ('../components/user/Member.vue'),
            },
            {
                path: 'personal', // 个人中心
                name: 'personal',
                component: () =>
                    import ('../components/user/Personal.vue'),
            },
            {
                path: 'order', // 我的订单
                name: 'order',
                component: () =>
                    import ('../views/user/Order.vue'),
                meta: {
                    navShow: false,
                },
            },
            {
                path: '/', // user home
                name: 'user',
                component: () =>
                    import ('../views/user/User.vue'),
                meta: {
                    navShow: true,
                },
            },
            {
                path: 'coupon', // 优惠券
                name: 'coupon',
                component: () =>
                    import ('../views/user/CouponView.vue'),
                meta: {
                    navShow: false,
                },
            },
            {
                path: 'card', // 会员卡
                name: 'card',
                component: () =>
                    import ('../views/user/Card.vue'),
                meta: {
                    navShow: false,
                },
            },
            {
                path: 'userInfo', // userinfo
                name: 'userInfo',
                component: () =>
                    import ('../components/user/Infor.vue'),
                meta: {
                    navShow: true,
                },
            },
            {
                path: 'my-ticket', // 我的影票
                name: 'myTicket',
                component: () =>
                    import ('../views/ticket/MyTicket.vue'),
                meta: {
                    navShow: false,
                },
            },
            {
                path: 'message', // 我的消息
                name: 'message',
                component: () =>
                    import ('../components/user/News.vue'),
            },
            {
                path: 'msgList', // 我的消息
                name: 'msgList',
                component: () =>
                    import ('../components/user/MsgList.vue'),
            },
        ],
    },

    {
        path: '/home', // 首页
        name: 'home',
        component: () =>
            import ('../views/home/index.vue'),
        meta: {
            navShow: true,
        },
    },
    {
        path: '/user',
        name: 'user',
        component: () =>
            import ('../views/user/index.vue'),
        meta: {
            navShow: true,
        },
    },
    {
        path: 'position', // 定位
        name: 'position',
        component: () =>
            import ('../views/position/index.vue'),
    },
    // {
    //   path: 'check', // 签到
    //   name: 'check',
    //   component: check,
    // },

    {
        path: '/ticket', // 影票
        name: 'ticket',
        meta: {
            index: 2,
        },
        component: () =>
            import ('../views/ticket/index.vue'),
        children: [{
            path: 'buy-ticket', // 购票
            name: 'buyTicket',
            component: () =>
                import ('../views/cinema/children/order.vue'),
            children: [{
                    path: 'pick-seat', // 选座
                    name: 'pickSeat',
                    component: () =>
                        import ('../views/cinema/children/pickSeat.vue'),
                },
                {
                    path: 'confirm-order', // 确认订单
                    name: 'confirmOrder',
                    component: () =>
                        import ('../views/cinema/children/order.vue'),
                },
            ],
        }, ],
    },
    {
        path: '/moviedetail',
        name: 'moviedetail',
        component: () =>
            import ('views/movie/movieInfo'),
    },
    {
        path: '/rate', // 电影评分
        name: 'rate',
        component: () =>
            import ('../views/rating/index.vue'),
    },
    {
        path: '/filmReview', // 影评
        name: 'filmReview',
        component: () =>
            import ('../views/movie/filmReview.vue'),
    },
    {
        path: '/actor', // 演员详情
        name: 'actor',
        component: () =>
            import ('../views/movie/actordetail.vue'),
    },
    {
        path: '/box-office', // 票房详情
        name: 'boxOffice',
        component: () =>
            import ('../views/movie/boxOffice.vue'),
    },
    {
        path: '/movie', // 电影
        name: 'movie',
        component: () =>
            import ('../views/movie/index.vue'),
        meta: {
            navShow: true,
        },
    },

    {
        path: '/cinema', // 影院
        name: 'cinema',
        component: () =>
            import ('../views/cinema/index.vue'),
        meta: {
            navShow: true,
        },
        children: [{
                path: 'detail', //影院详情
                name: 'detail',
                component: () =>
                    import ('views/cinema/children/cinemaDetail.vue'),
                meta: {
                    index: 2,
                },
            },
            {
                path: 'address',
                name: 'address',
                component: () =>
                    import ('views/cinema/children/address'),
                meta: {
                    index: 2,
                },
            },
            {
                path: 'pickseat',
                name: 'pickseat',
                component: () =>
                    import ('views/cinema/children/pickSeat'),
                meta: {
                    index: 2,
                },
            },
            {
                path: 'order',
                name: 'order',
                component: () =>
                    import ('views/cinema/children/order'),
                meta: {
                    index: 2,
                },
            },
            {
                path: 'map', // 影院地图
                name: 'map',
                component: () =>
                    import ('../views/cinema/children/address.vue'),
            },
        ],
    },
    {
        path: '/search', // 搜索
        name: 'search',
        component: () =>
            import ('../views/search/index.vue'),
    },
    {
        path: '/now', // 即将上映
        name: 'now',
        component: () =>
            import ('../views/movie/now.vue'),
        meta: {
            navShow: true,
        },
    },

    {
        path: '/login',
        name: 'login',
        component: () =>
            import ('../views/login/index.vue'),
    },

    {
        path: '/',
        redirect: '/home',
    },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes,
})

export default router